package com.example.administrator.z.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.administrator.z.R;
import com.example.administrator.z.adapter.SchoolNoticeAdapter;
import com.example.administrator.z.entity.NoticeData;

import java.util.ArrayList;
import java.util.List;

public class SchoolNoticeFragment extends Fragment {
    private SchoolNoticeAdapter schoolNoticeAdapter;
    private List<NoticeData> mList = new ArrayList<>();
    private ListView mListView;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_girl, null);

        findView(view);

        schoolNoticeAdapter = new SchoolNoticeAdapter(getActivity(),mList);
        mListView.setAdapter(schoolNoticeAdapter);
        return view;


    }

    private void findView(View view) {

        mListView = (ListView) view.findViewById(R.id.mListView);
        for (int i = 0; i < 8; i++){
            NoticeData data = new  NoticeData();
            data.setTime("2018-1010");
            data.setTitle("中秋节快到了");
            data.setContent("哦时间过计算机管理决赛第六感觉哦圣诞节哦i感觉哦i家dogi集散地");
            data.setAuthor("发布人：实验小学");

            mList.add(data);
        }

    }
}
